package common;

import java.rmi.RemoteException;
import java.util.Calendar;

import common.rmi.event.RemoteUserEvent;

public class UserEvent extends Event implements RemoteUserEvent{
	
	private static final long serialVersionUID = 1L;
	
	private String userName;
	
	public UserEvent(String type, String userName) throws RemoteException {
		super(type);
		this.userName=userName;
	}
	
	public String getUserName(){
		return this.userName;
	}
	
	public String toString(){
		Calendar time=Calendar.getInstance();
		time.setTimeInMillis(this.timestamp);
		return this.type+": "+time.getTime().toString()+" - username: "+userName;
				//USER_LOGIN: 31.10.2012 20:00:01 CET - user alice logged in 
	}

	@Override
	public String stringRep() throws RemoteException {
		Calendar time=Calendar.getInstance();
		time.setTimeInMillis(this.timestamp);
		return this.type+": "+time.getTime().toString()+" - username: "+userName;
	}
}
